home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / AETracker.sea / Read Me • AETracker < prev    next >
Text File  |  1992-08-11  |  11KB  |  217 lines

  1. AETracker v 3.0
  2. C.K. Haun <TR>
  3. RavenWare Software
  4. 22045 McClellan Rd.
  5. Cupertino, CA 95014
  6. ALink - C.K.HAUN
  7. GEnie - C.Haun1
  8. CIS - 75300,1001
  9.  
  10. Change history at end of this file
  11. Past users, please read the section 'External Control' for important new features
  12.  
  13. The Problems:
  14. What's going wrong in my AppleEvent routines?!?!?!?
  15. The Solution:
  16. AETracker!
  17. AETracker is an INIT/CDev that allows you to log AppleEvent activity on your system.  You can watch as much or as little AppleEvent manager (AEM) information as you like, and pull a little info or a lot of information about what's happening.
  18. AETracker provides many levels of tracking, fully user  configurable.
  19.  
  20. AETracker lets you track the inputs and outputs to all your AEM calls, and will show you exactly where errors are occurring.
  21.  
  22. Another very helpful use for AETracker is to sno0p other people's applications, you can get a full track of what AEM activity other applications are doing.
  23.  
  24. Enough market hype, here's the details.....
  25.  
  26. AETracker patches four traps, PostEvent, GetNextEvent, Close, and Pack8 (the AEM trap).
  27.  
  28. The first three are "housekeeping" patches for AETracker, mainly they let the CDEV and you talk to the INIT.
  29.  
  30. The PostEvent patch watches for the 'toggle' key sequence.  You can set any single key + all modifiers as the toggle to turn AETracker on and off.  Be SURE that you are not using that keystroke in another INIT or Application, since AETracker will eat the
  31. event when it sees it, or alternately another INIT may already have
  32. eaten it.  
  33. The PostEvent patch also looks for an event posted by the CDEV that tells it to reload the CDEV resources, that's how you can change AETracker's settings without rebooting the machine.  
  34.  
  35. The GetNextEvent patch looks for flags that the PostEvent patch sets,  and does things based on the flag, since GNE is memory moving safe and PostEvent ain't.
  36.  
  37. The Close patch is designed to keep the AETrack file open until you close it, despite ExitToShell trying to close the file when the app that was frontmost when it was created quits.
  38. • Note:  Because the Close patch exists, you have to _explicitly_ tell AETracker to turn itself off.  That's why the flashing indicator in the menu bar exists, to let you know that AETracker is still running, so you don't end up with a lot bigger track file than you anticipated.
  39.  
  40. The Pack8 patch is where the real business happens;
  41.  
  42. When AETracker is toggled on, here's what happens....
  43. A work file is opened, it will be named "AETrackXXXX" where 
  44. XXXX is Ticks at toggle time (creative, huh?).  This file will always be
  45. created in the Control Panels folder until you set a different directory with the button in the Control Panel. 
  46. • Note:  In the unlikely instance that there is already a file named AETrack-XXXX in the control panels folder, AETracker will increment the first letter of the name until it can create the file, so you'll get things like BETrack-XXXX, CETrack-XXXX.  
  47. It may seem like that'll never happen, but I've done it twice during debugging.  
  48. You can change the file name by modifying 'STR ' resource -4064, but
  49. whatever you change it to will still have the XXXX appended to it.
  50.  
  51.  
  52. The Pack8 (AppleEvent manager) patch is enabled.  Depending on the
  53. myriad settings you can make, that patch will start writing data
  54. to the work file.
  55.  
  56. AppleEvent traffic happens, and a nice log is written out.
  57. The log will contain information about which routine was called, what application called it, when (in ticks) it was called, what parameters were passed to it, and what parameters were returned.  Again, the amount of info in the log will depend on the settings you give the the Control Panel.
  58. Also, a small black circle will flash in the right side of the menu bar, so you can tell that AETracker is tracking.
  59.  
  60. Here's a small sample, taken from a log of my AEObject sample
  61.  
  62. Dup at TickCount: $0000072E
  63. AECreateDesc
  64. called in routine:MakeAddress 
  65. Descriptor Type:psn 
  66. The Data :  $0000 0000 0000 0002 
  67. In ASCII :  
  68. Results returned....
  69. Descriptor data;
  70. Descriptor Type:psn 
  71. The Data :  $0000 0000 0000 0002 
  72. In ASCII :  
  73.  
  74. Dup at TickCount: $0000072F
  75. AECreateAppleEvent
  76. called in routine:SendGetData 
  77. Creating    Class:  aevt ID: getd return ID:  $FFFF transaction ID :$00000000
  78.  
  79. Dup at TickCount: $00000730
  80. AECreateDesc
  81. called in routine:BuildWindowObject 
  82. Descriptor Type:long
  83. The Data :  $0000 0001 
  84. In ASCII :  
  85. Results returned....
  86. Descriptor data;
  87. Descriptor Type:long
  88. The Data :  $0000 0001 
  89. In ASCII :  
  90.  
  91.  
  92.  
  93. There are some machine cycles involved in all this.  I'm head and tail patching Pack8, writing a lot of junk out to disk, and doing a lot of analysis of the data passed to the AEM on every AEM trap call.
  94. I wrote AETracker in assembly to speed it up as much as I could, but
  95. that still involves some time.  And, since I don't know what you're debugging on, I had to stick with 68000 opcodes. Its fast, but not as fast as if it wasn't there at all.  
  96.  
  97. Eventually you get all the info you need and you toggle AETracker off.
  98. The work file is closed, the Close and Pack8 patches are deactivated, 
  99. and AETracker waits for another toggle.
  100.  
  101. You go read the track file (it's type TEXT) and are greatly impressed and
  102. find all the AE bugs in your program,  recode everything,  go
  103. golden master 3 weeks early, sell 1000000000 copies of your application, and
  104. give me 10% royalties.
  105.  
  106. Well, hopefully the information will help.
  107.  
  108. The Settings
  109. • Note:  Changes to settings take effect as soon as the Control Panel is closed (you do NOT have to reboot!), so you can change your configuration and be testing again quickly.  
  110.  
  111. Toggle Key
  112. This is the key that turns AETracker on and off.  It's a single key stroke with any combination of the 4 modifier keys down.  Again, make sure that this key setting doesn't conflict with any other INITs (like SwitchApp, another fine RavenWare INIT) or whatever you have installed, since I zero out the event after I see it.
  113.  
  114. Tracking
  115. These two radio buttons tell AETracker what application it should care
  116. about.  You have two choices, All Applications or Frontmost Only.
  117. If you select All Applications, then AETracker records AE info happening
  118. anywhere on your system.
  119. If you select Frontmost Only, AETracker only will record AE action for
  120. the application that is frontmost WHEN AETracker IS TURNED ON!
  121. If that application subsequently goes into the background, AETracker
  122. WILL STILL TRACK IT AND ONLY IT!  I like this a lot.
  123. Of course, if the application that you started AETracker in quits, it's PSN doesn't exists anymore.  I am NOT checking for this, AETracker will just not be recording any information any more, even though it's still active.
  124.  
  125. Routine Selection
  126. There are three radio buttons that let you set how much of the AEM stuff 
  127. going on you want to know about.  The first button "Every Danged Thing" does just what it says.  It will track information on all 53 AEM calls AND the 7 Object Support Library routines I know about.  
  128. This gives you a full log of information, and is REALLY neat.
  129.  
  130. The second, Limited, tracks only AESend and AEProcessAppleEvent.  This is a good place to start, to give you a rough idea of what is going on in your system.
  131.  
  132. "Let Me pick 'em" introduces you to more radio buttons than you ever wanted to
  133. see.  But it also gives you a great deal of control.  The dialog that comes up lets you specify exactly which calls you want to track, if you KNOW that there's a problem in AEGetKeyPtr you can track just that.
  134. And if anyone can come up with a better way to do this than 50ish checkboxes, 
  135. let me know.  But NOT popup menus, that would be worse, OK?
  136.  
  137. Information Selection
  138. There are three information level settings you can pick.
  139.  
  140. "Minimum" gives you just routine name, application name, and tick count.
  141.  
  142. "More" gives you the above and information about the parameters passed to the AEM routine.  It will also dump some of the data passed to some routines (AEPutParamPtr, for example).  It dumps only 40 bytes of the data.  Is that enough?  Would you like to see more?  Let me know.
  143.  
  144. "A great deal of information"  head and tail-patches Pack8, and gives you everything that "More" does, plus reports on any errors and gives you details about the paramters returned from a call.
  145.  
  146. New for version 3 of AETracker is an additional check box under the Information Level radio buttons, titled 'Include calling routine name'.
  147. When this box is checked, AETracker will attempt to find the MacsBug symbol for the routine that the AppleEvent call was made from.  This can aid you a lot in finding out exactly where things are happening.
  148. This may not always work, sometimes the routine has no name (as with routines in the Object Support Library) or AETracker may just not be able to deduce it.  If that is the case, AETracker just doesn't print anything.
  149.  
  150.  
  151. Supporting Players:
  152. There is one resource you may want to play with, the FTYP resource.  This is the creator of the track file I create.  I have it set so the creator is MPW, you can change this to whatever you want to read the file in.  The file will _always_ be created as a text file.
  153.  So why isn't the resource named CTYP?  Because I'm goofy.
  154.  
  155.  
  156.  
  157. Wish I knew how:
  158. How can I tell when an AEM routine is being called by the OSL?  I'd like to ignore those, but since the OSL is linked into the application I can't differentiate OSL AEM calls from App OSL calls, since they come from the same zone.  Any hints?
  159.  
  160. What are those unknown selectors the OSL is using????
  161.  
  162.  
  163. I hope you find AETracker useful.  I know I do, I have debugged several problems already because I wrote this.
  164. Any comments, suggestions, or additions you have please send along to me, I'll try and implement them.
  165. Please also send me the shareware fee ($5, c'mon).
  166.  
  167. C.K. Haun
  168. January 1992
  169.  
  170. beta 1 Jan 92
  171. • Initial release
  172.  
  173. beta 2  Feb 92
  174. • Fixed small startup bug.
  175. • Unrolled a few loops
  176.  
  177. beta 3 changes Mar 92
  178. • Finally added a path selection button for the output file, argued with
  179.   the Alias Manager for a while about what a d*mned folder alias really means 
  180. • got rid of spurious alert when you cancel out of custom selector list
  181.  
  182. Version 2 changes April 92
  183. • Changed some more code to make things go even faster
  184. • Added tail-patch code. AETracker will now report result of calls, error and
  185.   parameter returns (Yaaaa!).
  186. • Added cheezy help dialog.
  187. • Projectorized the whole thing, for reasons that are unclear to me but I thought it 
  188.    might be fun to play with Projector.  I was wrong.
  189. • Increased amount of data given from some calls.
  190.  
  191. Version 3 changes August 92
  192. • External Control!  Added Gestalt selector and 5 external routines
  193. • Created 'AETracker Monitor', can be used by itself or as sample
  194.    code for your own interface
  195. • Added some more data generation
  196. • Added MacsBug symbol output.
  197. • More speed changes 
  198.    !NOTE!  parsing strings (STR# -4064) MUST all be mod 4!  I do this
  199.               for speed, if you edit those strings you MUST be sure they
  200.               are all evenly divisible by 4, or your results will be bad.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. Written under the
  214. FredWare principle;
  215. If you don't like it
  216. Write a better one yourself!
  217.